package graph.day13;

import java.util.Arrays;

public class Leetcode_283 {

    public static void moveZeroes(int[] nums) {
        int slow = 0;
        for (int fast = 0; fast < nums.length; fast++) {
            if (nums[fast] != 0) {
                nums[slow++] = nums[fast];
            }
        }
        for (int j = slow; j < nums.length; j++) {
            nums[j] = 0;
        }
    }

    public static void main(String[] args) {
        int[] nums = {0, 1, 0, 3, 12, 5, 0, 7};
        moveZeroes(nums);
        System.out.println(Arrays.toString(nums));
    }
}
